<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function show(){
				//获取用户数据
				var _aid=aid.value;
				var _address_id=address_id.value;
				// console.log(_aid,_address_id);
				//1.创建异步对象
				var xhr= new XMLHttpRequest();
				// console.log(12);
				//2.创建请求，打开连接
				xhr.open("put",`/order/v1/order_revise`,true);
				var formdata=`aid=${_aid}&address_id=${_address_id}`;
				xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				// console.log(123);
				//3.发送请求
				xhr.send(formdata);
				// console.log(1234);
				//4.创建监听，接收响应
				xhr.onreadystatechange=function(){
					// console.log(12345);
					if(xhr.readyState==4 && xhr.status==200){
						var r=xhr.responseText;
						// console.log(2);
						if(r==1){
							d1.innerHTML="修改成功"
						}else{
							d1.innerHTML="修改失败"
						}
					}
				}
				
			}
			 
		</script>
	</head>
	<body>
		<input type="text" id="aid">编号<br>
		<input type="text" id="address_id">地址<br>
		<button onclick="show()">修改</button>
		<div id="d1"></div>
	</body>
</html>
